<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>修改密码</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(
			function() {
				$("#oldPassword").focus();
				layui.use([ 'laypage', 'form' ], function() {
					form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
					form.render();
				});
				$("#inputForm")
						.validate(
								{
									rules : {},
									messages : {
										confirmNewPassword : {
											equalTo : "输入与上面相同的密码"
										}
									},
									submitHandler : function(form) {
										loading('正在提交，请稍等...');
										form.submit();
									},
									errorContainer : "#messageBox",
									errorPlacement : function(error, element) {
										$("#messageBox").text("输入有误，请先更正。");
										if (element.is(":checkbox")
												|| element.is(":radio")
												|| element.parent().is(
														".input-append")) {
											error.appendTo(element.parent()
													.parent());
										} else {
											error.insertAfter(element);
										}
									}
								});
			});
</script>
</head>
<body>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
			<li><a href="${ctx}/sys/user/info">个人信息</a></li>
			<li class="layui-this"><a href="${ctx}/sys/user/modifyPwd">修改密码</a></li>
		</ul>
		<div class="layui-tab-content"></div>
	</div>
	<form:form id="inputForm" modelAttribute="user"
		action="${ctx}/sys/user/modifyPwd" method="post" class="layui-form">
		<form:hidden path="id" />
		<sys:message content="${message}" />
		<div class="layui-form-item">
			<label class="layui-form-label">旧密码:</label>
			<div class="layui-input-inline">
				<input id="oldPassword" name="oldPassword" type="password" value=""
					maxlength="50" minlength="3" class="layui-input required" /> <span
					class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">新密码:</label>
			<div class="layui-input-inline">
				<input id="newPassword" name="newPassword" type="password" value=""
					maxlength="50" minlength="3" class="layui-input required" /> <span
					class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">确认新密码:</label>
			<div class="layui-input-inline">
				<input id="confirmNewPassword" name="confirmNewPassword"
					type="password" value="" maxlength="50" minlength="3"
					class="layui-input required" equalTo="#newPassword" /> <span
					class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"></label>
			<div class="layui-input-inline">
				<input id="btnSubmit" class="layui-btn" type="submit" value="保 存" />
			</div>
		</div>
	</form:form>
</body>
</html>